package com.model.service.base.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.model.dao.base.BaseDao;
import com.model.service.base.BaseService;
import com.opensymphony.xwork2.interceptor.annotations.Allowed;
@Service
public class BaseServiceImpl<T> implements BaseService<T>{

	@Allowed
	BaseDao<T> baseDao;
	@Override
	public void save(T t) {
		baseDao.save(t);
	}

	@Override
	public void update(T t) {
		baseDao.update(t);
		
	}

	@Override
	public void delete(T t) {
		baseDao.delete(t);
	}

	@Override
	public List<T> QueryList(Class<T> t,Object[] objects) {
		
		return baseDao.QueryList(t,objects);
	}

	@Override
	public T QueryById(Class<T> t,int id) {
		return baseDao.QueryById(t,id);
	}

	@Override
	public List<T> QueryBySqlList(String sql, Object[] args,Class<T> entityClass) {
		return baseDao.QueryBySqlList(sql, args,entityClass);
	}

	@Override
	public List<T> QueryByHqlList(String hql, Object[] args) {
		return baseDao.QueryByHqlList(hql, args);
	}

	@Override
	public int getAllRowCount(String hql, Object[] args) {
		return baseDao.getAllRowCount(hql, args);
	}

	@Override
	public List<T> queryForPage(int offset, int length, String hql,Object[] args) {


		
		return baseDao.queryForPage(offset, length, hql,args);
	}

	public BaseDao<T> getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(BaseDao<T> baseDao) {
		this.baseDao = baseDao;
	}

}
